Synchronous memory read data capture

ABSTRACT

A method of snap-shot data training to determine the optimum timing of the DQS enable signal in a single read operation is provided. This is accomplished by first writing a Gray code count sequence into the memory and then reading it back in a single burst. The controller samples the read burst at a fixed interval from the time the command was issued to determine the loop-around delay. A simple truth table lookup determines the optimum DQS enable timing for normal reads. Advantageously, during normal read operations, the first positive edge of the enabled DQS signal is used to sample a counter that is enabled every time a command is issued. If the counter sample changes, indicating timing drift has occurred, the DQS enable signal can be adjusted to compensate for the drift and maintain a position centered in the DQS preamble. This technique can also be applied to a system that uses the iterative approach to determining DQS enable timing on power up. Another embodiment of the invention is a simple, low latency clock domain crossing circuit based on the DQS latched sample of the counter.

RELATED APPLICATION

This application is a continuation of application Ser. No. 11/477,659,filed Jun. 30, 2006, now U.S. Pat. No. 7,685,393, issued on Mar. 23,2010, which is hereby incorporated by reference in its entirety.

FIELD OF THE INVENTION

The present invention relates generally to synchronous memories andassociated memory controllers. More particularly, the present inventionrelates to the control and transfer of read and write data between amemory controller and a synchronous memory using bi-directionaldatabusses and bidirectional data strobe signals.

BACKGROUND OF THE INVENTION

In source synchronous signaling, a data strobe clock is driven by thetransmitting device along with the data. The clock and data paths fromtransmitter to receiver are matched. At the receiving device the datastrobe clock is used to latch incoming data. In Double Data Rate (DDR)SDRAM memory systems, the external databuses are bidirectional. Writedata is sent to the memory from a memory controller and read data issent from the memory to the controller. When no data is being sent, thebus returns to a tri-state level defined by the bus transmission linetermination voltage.

Control of the bidirectional data strobe clock also changes depending onwhich device is driving data onto the databus. The data strobe clockinput on the controller and the memory device must be gated by an enablesignal to prevent the spurious clock edges created by a tri-stated clockinput level from triggering internal data capture. When neither thememory controller nor the memory is driving the data strobe, the datastrobe line will be pulled to the bus termination voltage by thetermination resistor. For DDR and DDR2 memories, the termination voltageVterm is Vddq/2, which is the same as the input buffer reference voltageVref. As a result, the data strobe input buffer produces anindeterminate value, which may change between ‘0’ and ‘1’ depending onnoise. On the memory chip this is easily accomplished because the writedata instruction and the write data itself arrive source synchronouslyfrom the controller and the skew between the two sets of signals will beless than one bit period. Before the first active edge of the datastrobe clock DQS there is a 2 bit preamble period during which DQS isdriven low. During this time the memory chip can assert the enablesignal.

During read operations the alignment between read command and read dataon the bidirectional bus is much less certain. The delay through thecommand and address output drivers, through the package and printedcircuit board connections to the memory device, back through the readdata output buffers, package, and printed circuit board, and finallythrough the input buffers of the memory controller can vary by many bitperiods depending on the system configuration and operating conditions.

A first problem associated with this alignment of read command and datais to determine, on system initialization, where in time to position theread data DQS enable signal so that it falls within the 2 bit preamble.A second problem is how to adjust for timing drift during operationcaused by temperature or supply voltage drift. A third problem is how totransfer data clocked in with DQS to the system clock domain when thephase between the DQS clock and master system clock CLK can becompletely arbitrary.

These problems did not exist in single data rate SDRAMs because therewas no DQS clock and read data had to meet setup and hold requirementswith respect to the master system clock CLK which originates from thecontroller.

Quad Data Rate (QDR) SRAM does not have the problem because separateread and write data busses exist with their own dedicated clocks. Sincethe clocks do not have to be tri-stated there is never any indeterminatestate.

An application of a bidrectional data strobe signal to DDR SDRAM isdisclosed in U.S. Pat. No. 6,889,336 granted to A. M. Schoenfeld et al.on May 3, 2005. At the initial DDR operating speeds DDR267 and DDR333,the 2 bit preamble period was still relatively large, 7.5 ns and 6.66 nsrespectively. It was still possible to accommodate a range of systemdesigns and operating conditions with fixed timing on the internal DQSenable. With DDR400 and DDR2 devices ranging from DDR2-400 to DDR2-800,there is a need for dynamic adjustment of the DQS enable time. Anexample set of typical loop-around read timing delays of a chip-to-chipcontroller to DDR SDRAM are as follows:

Delay from; min. max. Command latch to controller pin 1.0 ns 3.0 ns PCBtrace to DDR SDRAM 0.5 ns 1.5 ns SDRAM command in to data out −0.5 ns0.5 ns PCB trace to controller 0.5 ns 1.5 ns Controller pin to datalatch 1.0 ns 3.0 ns TOTAL 2.5 ns 9.5 ns

The read data timing can vary by more than the width of the DQS preambleinterval at data rates for DDR400 and higher. Fixed timing is not arobust solution.

As an example, several implementations of DQS gating are described inthe LSI Logic 0.11 um DDR2 PHY document cw000733_1_0 dated February2005. The PHY actually supports three different approaches for enablingthe DQS read strobe, using a signal called GATEON.

The first approach “Programmable GATEON” allows the user to program thetiming of GATEON based on a programmable delay register and the time theread command is issued. Read data training is required with this scheme.Read data training involves attempting a number of read operations withdifferent delay register settings, finding the settings for whichexpected data is properly received, and then setting the delay registersomewhere in the middle of the pass range. A disadvantage of thisapproach is that it requires higher level intelligence somewhere in thecontroller, and a significant amount of time during systeminitialization to determine the optimum setting. Also, it cannotaccommodate timing drift during operation.

The second approach is called “Feedback GATEON”. A signal is generatedand sent to a pin in the same way a command is generated. This signalcan be routed along a PCB trace with the same length and loading as thecommand signal to the memory and back to the controller. At thecontroller the delayed signal is used to trigger the DQS enable. Thedisadvantage of this approach is that it requires 2 additional pins, PCBtraces, and consumes power. It does not perfectly match the actualcommand to read data loop-around delay.

The final approach is called “External GATEON” where the user somehowgenerates the GATEON signal. This method would also require at least oneadditional pin. This also requires some interconnect that mimics thebehaviour of the actual databus.

SUMMARY OF THE INVENTION

According to one broad aspect, the invention provides a method forcontrolling a memory, the method comprising: measuring a read delaybetween the memory and a memory controller; writing an initializationsequence to predetermined locations of the memory; sending a readcommand to the memory to read the predetermined locations and receivingreturned data signals; and a predetermined time after sending the readcommand, sampling the returned data signals to produce an initializationsample that is used to determine the read delay between the memory andthe memory controller.

For example, the memory includes a DDR SDRAM memory or a slave device ona bidirectional bus with bidirectional source synchronous strobes.

According to another broad aspect, the invention provides a memorycontroller for controlling a memory, the controller comprising: a readdelay determination circuit and a DQS enable circuit; duringinitialization, the read delay determination circuit determining a readdelay between sending a read command to the memory and receiving datasignals in return, the read delay determination circuit comprising acircuit for sampling the data at a predetermined time to produce aninitialization sample, and a lookup table that stores a respective readdelay in respect of each permutation of the initialization sample; theDQS circuit being adapted to gate a received DQS clock signal as afunction of the read delay.

For example, the memory includes a DDR SDRAM memory.

One embodiment of the invention provides a method in a memory controllerfor controlling a memory that has a bidirectional read/write bus withsource synchronous clocking and a bidirectional data strobe, the methodcomprising: measuring a read delay between the memory and the memorycontroller by: the memory controller writing a Gray code initializationsequence to predetermined locations of the memory; the memory controllersending a read command to the memory to read the predetermined locationsand receiving returned data signals; a predetermined time after sendingthe read command, the memory controller sampling the returned datasignals to produce an initialization sample; using the initializationsample to determine the read delay between the memory and the memorycontroller.

Another embodiment of the invention provides a memory controller forcontrolling a memory that has a bidirectional read/write bus with sourcesynchronous clocking and a bidirectional data strobe, the controllercomprising: a read delay determination circuit and a data strobe enablecircuit; during initialization, the read delay determination circuitdetermining a read delay between sending a read command to the DDR SDRAMand receiving data signals in return, the read delay determinationcircuit comprising a circuit for sampling the data at a predeterminedtime to produce an initialization sample, and a table lookup functionthat stores a respective read delay in respect of each permutation ofthe initialization sample; the data strobe enable circuit being adaptedto gate a received DQS as a function of the read delay.

Another embodiment of the invention provides a data strobe enablecircuit for use with a memory that has a bidirectional read/write buswith source synchronous clocking and a bidirectional data strobe, thecircuit comprising: an input for receiving a data strobe signal; anoutput for producing a gated data strobe signal; an data strobe enableand data strobe disable; a multiplexer that gates the data strobe signalas a function of a select input; a select input generator circuit thatsets the select input to select the data strobe signal upon activationof the data strobe enable, and that sets the select input to deselectthe data strobe signal upon activation of the data strobe disable andfollowing a next rising edge of the data strobe signal.

Another embodiment of the invention provides a drift detector circuitcomprising: a first circuit for latching a first value of a first phaseof a master clock synchronously with an input clock signal; a secondcircuit for latching a second value of a second phase of the masterclock synchronously with the input clock signal; wherein a change ineither the first value or the second value indicates that the inputclock signal has drifted relative to the master clock source by at leasta predetermined amount.

An embodiment of the invention provides a method of snap-shot datatraining to determine the optimum timing of the DQS enable signal in asingle read operation. This is accomplished by first writing a Gray codecount sequence into the memory and then reading it back in a singleburst. The controller samples the read burst at a fixed interval fromthe time the command was issued to determine the loop-around delay. Asimple truth table lookup determines the optimum DQS enable timing fornormal reads.

Advantageously, during normal read operations, the first positive edgeof the enabled DQS signal is used to sample a counter that is enabledevery time a command is issued. If the counter sample changes,indicating timing drift has occurred, the DQS enable signal can beadjusted to compensate for the drift and maintain a position centered inthe DQS preamble. This technique can also be applied to a system thatuses the iterative approach to determining DQS enable timing on powerup.

Another embodiment of the invention is a simple, low latency clockdomain crossing circuit based on the DQS latched sample of the counter.

Other aspects and features of the present invention will become apparentto those ordinarily skilled in the art upon review of the followingdescription of specific embodiments of the invention in conjunction withthe accompanying figures.

BRIEF DESCRIPTION OF THE DRAWINGS

Embodiments of the present invention will now be described, by way ofexample only, with reference to the attached Figures, wherein:

FIG. 1 is a block diagram of an SDRAM device with read delaydetermination, provided by an embodiment of the invention;

FIGS. 2A, 2B and 2C are example timing diagrams for read delaydetermination;

FIG. 3 is a look-up table for determining read delay as a function of aninitialization sample corresponding to the examples of FIGS. 2A, 2B and2C;

FIG. 4 is a circuit diagram for receiving read data in a memorycontroller and for generating an initialization sample corresponding tothe examples of FIGS. 2A, 2B and 2C;

FIG. 5 is another timing diagram for a method of read delaydetermination;

FIG. 6 is a look-up table corresponding to the example of FIG. 5;

FIG. 7 is a circuit diagram of a circuit for receiving read data andgenerating an initialization sample corresponding to the example of FIG.5;

FIG. 8A is a circuit diagram of an example circuit for enabling the DQSonce the read delay has been determined;

FIG. 8B is an example of a timing diagram corresponding to FIG. 8A;

FIG. 9A is a circuit diagram of a circuit for detecting data strobedrift; and

FIG. 9B is an example of a timing diagram corresponding to the circuitof FIG. 9A.

DETAILED DESCRIPTION

In the following detailed description of sample embodiments of theinvention, reference is made to the accompanying drawings which form apart hereof, and in which is shown by way of illustration specificsample embodiments in which the present invention may be practiced.These embodiments are described in sufficient detail to enable thoseskilled in the art to practice the present invention, and it is to beunderstood that other embodiments may be utilized and that logical,mechanical, electrical, and other changes may be made without departingfrom the scope of the present invention. The following detaileddescription is, therefore, not to be taken in a limiting sense, and thescope of the present invention is defined by the appended claims.

Referring now to FIG. 1, shown is a memory controller 20 connected to aDDR-SDRAM 22 through connections including: a unidirectional bus 24 usedto send addresses, commands and clock from the memory controller 20 tothe DDR SDRAM 22; a bi-directional bus 26 for writing data to the DDRSDRAM 22 and reading data from the memory, with the signals on bus 26indicated as “DQ”; a bi-directional connection 28 for carrying a datastrobe clock (DQS). In a write operation, the DQS is generatedsynchronously with the write data by the memory controller 20. In a readoperation, read data from the DDR SDRAM 22 and the DQS are generatedsynchronously by the memory. The memory controller 20 has a read delaydetermination circuit 30 that determines the read delay between thememory controller 20 and the DDR SDRAM 22. The memory controller 20 hasa DQS enable circuit 32 that generates a gated DQS signal 34 based onthe incoming DQS signal 28 as a function of an output of the read delaydetermination circuit 30.

For this example, the memory controller is a synchronous ASIC circuitthat operates with a main clock. A master DLL inside the controller (notshown) derives a 0° phase difference clock which is phase locked to themain clock, and also 90°, 180°, and 270° phases (not shown). A slave DLLalso inside the controller (not shown) creates a constant 90° phaseshift.

The functionality of the read delay determination circuit 30 will now bedescribed by way of example in further detail with further reference toFIG. 1 and the timing diagrams of FIGS. 2A, 2B and 2C. On power up, thememory controller 20 first waits for the DLL to lock and reliablyproduce 0°, 90°, 180°, and 270° phases, and also 90° delayed versions ofDQS. This will allow the controller's data input latches to reliablycapture read data. The controller 20 then sends the appropriate power upcommands to the DDR SDRAM 22. This is followed by writing aninitialization sequence to the memory, for example, a two bit Gray codesequence in a burst to successive byte locations in the memory. It isnoted that Gray codes are not unique and that any Gray code can beemployed. Bits 0 to 3 contain the LSB of the two bit Gray code, whilebits 4 to 7 contain the MSB of the two bit Gray code as follows:

Bit #: Time 76543210 t = 0 00000000 t = 1 00000000 t = 2 00001111 t = 300001111 t = 4 11111111 t = 5 11111111 t = 6 11110000 t = 7 11110000

The Gray code pattern insures that only one bit changes at any one timeand any slight differences in delay between the two bits will not resultin erroneous counts. Writing each Gray code bit to multiple locations(four in the above example) allows for multiple samples to be taken inparallel as will be detailed below.

FIG. 2A shows a timing diagram for a maximum read delay case; FIG. 2Bshows a timing diagram for a nominal read delay case and FIG. 2C shows atiming diagram for a minimum read delay case. Each of these timingdiagrams shows a 0° clock 40, a five bit Gray code counter42,44,46,48,50, command sequence 52, DQS 54, DQ 56, DQS90 58, DQ0 60,DQ1 62 and count_en 64.

In each case the Gray code counter has a first bit c₀ 42 that alternateswith the same period as the 0° clock 40, a second bit c₁ 44 thatoscillates at twice the period of the 0° clock, a third bit c₂ 46 thatoscillates at four times of the period of the 0° clock, a fourth bit c₃48 that oscillates with eight times of the period of the 0° clock, and afifth bit c₄ 50 that oscillates with sixteen times of the period of the0° clock. The timing of the five bits 42,44,46,48,50 is such that a fivebit Gray code is generated with the code word changing on every quartercycle of the 0° clock.

Having written the Gray code to memory as described above, the processof determining the read delay continues with a READ command 66 as partof a command sequence 52 on the rising edge of the 0° clock 40. The Graycode counter 42,44,46,48,50 is enabled by the falling edge of a count_en64 that accounts for a minimum read latency (RL) in responding to theREAD command. In the illustrated example, it is assumed that the minimumread latency is three clock periods. If there are no other delays in thesystem, then data would start to arrive at the memory controller at theend of this time.

Assuming however that there is some other delay in the system, the DQS54 is activated sometime later with the first rising edge of the DQS 54being shown to be preceded by a two bit preamble 68. Note that while theDQS is not active, it is in a high impedance state approximately midwaybetween logic high and logic low. DQS 54 is active long enough tocomplete the read for a particular block length. This is followed by apostamble 69 after which it returns to the high impedance state.

Data signal DQ 56 is received from the memory synchronously with the DQS54. Because it is a double data rate system, a bit is received on DQ 56for each rising edge and each falling edge of the DQS 54. In order toperform the snapshot data training, the read command 66 is issued inassociation with the address in the memory to which the Gray codesequence was written as described above. DQS90 58 is a 90° phase shiftedversion of DQ 56 that is generated to allow sampling edges centered inthe middle of the received data pulses. This can be produced with theslave DLL for example. DQ0 60 shows the data latched on the rising edgeof DQS90 58, while DQ1 62 shows the data latched with the falling edgeof the DQS90 58.

In FIGS. 2A, 2B and 2C, DQ, DQ0 and DQ1 employ a shorthand notation tosummarize the bits read from all 8 bits of the stored Gray code. DQ, DQ0and DQ1 all show the contents being read from the stored two bit Graycode at a given instant of time. DQ, DQ0, DQ1=“00” means that duringthat time the first bit of the Gray code read from any memory locationto which the first bit was written is “0”, and the second bit of theGray code read from any memory location to which the second bit waswritten is “0”. The full details for the individual bits DQ₁, . . . ,DQ₈ are shown in FIG. 2B only.

Comparing FIGS. 2A, 2B, 2C it can be seen that depending upon the readdelay, the read data DQ 56 begins to arrive from the memory at differenttimes, and the different times can be associated with different statesof the Gray code counter 42,44,46,48,50.

In a first example implementation, generally indicated at 70 in FIG. 2B,each of eight input bits has a respective extra input latch whichsamples input latched read data DQ0 with a single phase of thecontroller clock. In FIG. 2B, the data on the eight bits is indicated atDQ₀ through DQ₇ 120,122,124, 126,128,130,132,134. It can be seen thatbits DQ₀ through DQ₃ capture the LSB of the two bit Gray code while bitsDQ₄ through DQ₇ capture the MSB of the two bit Gray code. In theillustrated example, it is assumed that DQ₀ and DQ₄ are latched with a0° phase; DQ₁ and DQ₅ are latched with a 90° phase, DQ₂ and DQ₆ arelatched with a 180° phase, and DQ₃ and DQ₇ are latched with a 270°phase. By sampling the contents of these eight latches at a definedinstant, an initialization sample is generated. In the illustratedexample, the 0° samples are taken at seven full clock cycles afterissuing the READ command, and the 90°, 180°, 270° samples are takensubsequent to this. The 0° samples are labeled b₀, b₄; the 90° samplesare labeled b₁, b₅; the 180° samples are labeled b₂, b₆; and the 270°samples are labeled b₃, b₇.

The various permutations of the initialization samples are organizedinto a truth table as shown by way of example in FIG. 3. This table canbe implemented as logic circuitry, for example registers, or a Read OnlyMemory (ROM) within the memory controller. In this case, theinitialization sample is shown in a table with the bits organized bysampling phase. Each initialization sample has eight bits, and in thetable the first two bits are the two bits sampled with the 0° degreephase (b₀ and b₄ in the example of FIG. 2B); the next two bits are thebit sampled with the 90° phase (b₁ and b₅ in the example of FIG. 2B);the next two bits are those sampled at the 180° phase (bits b₂ and b₆for the example of FIG. 2B) and the next two bits are the two bits thatwere sampled at the 270° phase (bits b₃ and b₇ in the example of FIG.2B). This approach necessitates the Gray code sequence to have beenwritten to the memory as indicated above, with the first bit of a twobit Gray code sequence being written to bits 0 through 3 of each byte,and a second bit of the two bit Gray code sequence being written to bits4 through 7 of each byte.

Alternatively, the same initialization sample could be generated usingonly two bits to which the two bit Gray code sequence was written. Thisis shown in the second example of FIG. 2B generally indicated at 72where it is assumed the first bit is read on DQ₀ and the second bit isread on DQ₄. In this case, it is necessary to sample each of DQ₀ and DQ₄with all four clock phases. The eight samples can then be used togenerate the same initialization sample as discussed above.

FIG. 2A shows the maximum delay case. In this case, the 0°, 90°, 180°,270° samples are “00 00 00 00”. From the timing diagrams, it can be seenthat the normal operation of the DQS90 first rising edge occurs nearGray count 15. Since the DQS 54 has a two bit preamble, enabling DQS atGray count 13 will ensure that it is enabled for the first rising edge.For a burst length of four, the DQS would be disabled at approximatelyGray count 20 whereas for a burst length of eight the DQS would bedisabled around Gray count 28. Referring to the truth table of FIG. 3,it can be seen that this information is entered into the table inassociation with the initialization sample “00 00 00 00”.

FIG. 2B shows a nominal delay case. The 0°, 90°, 180° and 270° samplesare “01 11 11 11” and these correspond to the sixth row of the table inFIG. 3. Finally, FIG. 2C shows the minimum delay case and the 0°, 90°,180°, 270° samples are “10 10 10 10” these corresponding with the firstrow in the truth table of FIG. 3. The table also includes in the righttwo columns an indication of which clock phase should be used to sampleDQ0 and DQ1 as a function of the delay. This specifies how to move dataover into the clock domain of the controller, i.e. synchronize databeing read from the memory to the controller based on the controller'smaster clock using either the rising edge of the falling edge of themain 0° clock to latch the data.

Having determined the read delay, DQS enable circuit 32 of FIG. 1enables/disables the incoming DQS and/or DQS90. More specifically,during normal read operations, the controller issues a READ command withblock length BL=8 and read latency RL=3 (in this example). The count_ensignal is asserted to start the Gray code counter at 0 following the 3rdclock edge after the read command was issued. Data cannot arrive anysooner than this. Note that the counter is a Gray code counter in whichonly a single bit will change at any time. The count value does notcorrespond to a normal binary encoding scheme. The counter incrementsevery ¼ clock period. Once the counter reaches the value stored in thetable for enabling or disabling (for the previously measured delay) theDQS is enabled or disabled accordingly.

In addition, the counter value is latched by the enabled DQS clock onthe rising edge corresponding to the first bit of data in the databurst. This value corresponds to a row in the truth table. If the valueis the same as in the previous read cycle or the initialization sequencedescribed in the preceding paragraph, then the loop-around delay hasremained constant. If the value is different the timing has drifted andthe DQS enable timing must be updated by the controller.

Referring now to FIG. 4, shown is the functional circuitry in the memorycontroller for receiving a single bit across the bidirectional bus 26 ofFIG. 1, according to an embodiment of the present invention. Shown is aDQS enable labeled DQS_EN 80, this being the DQS enable input generatedby the DQS enable circuit 34 of FIG. 1. The DQS enable 80 gates a DQS90input 58, and an inverted DQS90 input 82. Recall that the DQS90 is a 90°phase shifted version of the DQS transmitted from the DDR SDRAM 22 tothe memory controller 20. DQS TB0 has rising edges corresponding withrising edges of DQS90, while DQS TB1 83 has rising edges correspondingwith falling edges of DQS90. The data signal is received on DQ_(n) 56,and this is connected to the D inputs of flip-flop 84 which latches onthe rising edge of DQS90 and D flip-flop 86 which latches on the fallingedge of DQS90. Flip-flop 84 outputs DQ0 88, this being the data latchedwith a rising edge of DQS90. Flip-flop 86 outputs DQ1 90, this being thedata latched on the falling edge of DQS 90.

Circuit 85 is provided to sample DQ0 88 and DQ1 90, and to produceoutputs 89 and 90 that are re-timed to be synchronous with the 0° clock.This is achieved by sampling DQ0 at the 0° and the 180° clock phaseswith flip-flops 92 and 94 and selecting between the 0° sample and the180° sample with a multiplexer 100 as a function of a multiplexer selectinput mux_sel 101. The mux_sel value used is a function of the readdelay and is stored in the look-up table as discussed above. This outputis then sampled at the 0° clock phase with D flip-flop 104 to produceoutput 89. DQ1 90 is sampled at 180° with D flip-flop 96 while the 0°sample corresponds to the output of D flip-flip 86. DQ1 is valid onehalf clock period later than DQ0. This effectively re-times DQ0 and DQ1data to be valid during the same interval. Either the 180° sample or the0° sample is selected with multiplexer 102, again as a function of themultiplexer select input mux_sel 101. The selected output is sampledwith 0° clock phase using D flip-flop 106 to produce the output 90.

The illustrated example includes a further pair of flip-flops 108,110for the purpose of re-timing outputs 89,90 to an RTL (register transferlanguage) clock input 120. The overall clocked outputs are indicated at109,111, these corresponding to the even bits and the odd bitsrespectively of the input 56. The entire circuit discussed thus far withrespect to bits 0 and 1 of the controller-memory interface is repeatedfor each bit of the interface. A typical interface width for currentdesigns of personal computers is 64 bits, but other applications havedifferent widths.

Circuit 122 is provided for the purpose of generating the initializationsample. This consists of a D flip-flop 112 that samples DQ0 88. This isre-timed to the 0° clock using flip-flop 114. Optionally, this isre-timed to the RTL clock with flip-flop 116.

To implement the functionality corresponding to the first example 70 ofFIG. 2B, depending upon which bit of the interface the circuit 122 isimplemented, the DQ0 is sampled with a different clock phase. In theillustrated example, for DQ₀ and DQ₄ the sampling takes place at the 0°clock phase. For DQ₁ and DQ₅ the sampling takes place at the 90° clockphase. For DQ₂ and DQ₆ the sampling takes place at the 180° clock phase.Finally, for DQ₃ and DQ₇ sampling takes place at the 270° clock phase.The overall result then is an eight bit initialization sample that canbe used together with the look-up table of FIG. 3 to determine what theread delay is. This in turn is used to determine when to enable theDQS_enable 80 for normal operations. Alternatively, in an implementationcorresponding with the second example 72 of FIG. 2B where two bits areeach sampled four times, the circuit 122 would only need to beimplemented for two bits of the interface, but would need to beimplemented four times such that each bit could be sampled at each ofthe 0°, 90°, 180°, 270° clock phases.

Note that in an alternate circuit implementation, the circuit 122 can bereproduced for every bit of the interface so that the logic is identicalfor all bits.

The initialization sample output is changing continuously as a functionof the input. The initialization sample is “valid” a predetermined timeafter the initial READ command.

Another embodiment allows for a larger range of latencies. A three bitGray code is required for the initialization pattern written to memoryto cover the delay range of 16 bit periods. It is no longer possible tocapture all four sampling phases of 3 bits in a single byte wideinterface with one sampling latch per bit. Either a 12 bit wideinterface is required or the individual Gray code bits can be sampledsequentially in separate read operations.

Referring now to FIG. 5, shown is a timing diagram that will be used todescribe this embodiment of the invention. With this embodiment, a threebit Gray code is employed rather than the two bit Gray code discussedabove. For example, the following might be the Gray code that is writtento successive byte locations in 16 successive 12 bit locations in thememory:

Bit #: 11 Time 109876543210 t = 0 000000000000 t = 1 000000000000 t = 2000000001111 t = 3 000000001111 t = 4 000011111111 t = 5 000011111111 t= 6 000011110000 t = 7 000011110000 t = 8 111100000000 t = 9111100000000 t = 10 111100001111 t = 11 111100001111 t = 12 111111111111t = 13 111111111111 t = 14 111111110000 t = 15 111111110000

In order to read out the entire 16 memory locations, two BL8 (burstlength eight) READ commands are performed. This is indicated in thecommand sequence 200 where there is a BL8 READ 201 and a second BL8 READ203. Rather than using a Gray counter implemented using dedicatedhardware as was the case of FIG. 3, the Gray code counter is implementedin RTL (not shown). In this case, the Gray code counter CK 202 startscounting at zero with the first READ command 201. The received DQS isshown at 204.

For the minimum delay case (RL=3) generally indicated at 220, DQS has afirst rising edge on clock count=12. The shorthand notation for thereceived DQ bits is indicated at 206; the 90 degree DQS clock is at 208;DQ0 (samples taken on the rising edge) and DQ1 (samples taken on thefalling edge) of DQS90 are indicated respectively at 210,212. For theexample illustrated, it is assumed that the initialization sample isgenerated during clock counts=40,41,42,43 with the result that there isa valid initialization sample just after that as indicated at 215. Thevalid initialization sample is then used together with a look-up tableto determine what the read delay is, and to then determine when toenable to the DQS enable.

The maximum delay case is indicated generally at 222. In this case, therising edge of DQS90 does not occur until just after clock count=40after the maximum read delay that can be accommodated.

FIG. 6 shows the look-up table for this example. In this case, thetiming is with reference to the Gray code counter 202.

FIG. 7 is a circuit diagram showing an example of an input DQ circuitfor the embodiment of FIG. 5. This circuit is basically the same as thatof FIG. 4. In this case, the sampling circuits for 12 bits produce 0°samples for DQ₀, DQ₄, DQ₈, 90° samples for DQ₁, DQ₅, DQ₉, 180° samplesfor DQ₂, DQ₆, DQ₁₀, and 270° samples for DQ₃, DQ₇ and DQ₁₁. The resultis a 12 bit initialization sample that can be used to look up anappropriate row in the look-up table of FIG. 6.

More generally, an N bit Gray code can be used. An N-bit Gray code has2^(N) codewords. In this case, the memory controller writes a Gray codeinitialization sequence to predetermined locations of the memory bywriting each of the 2^(N) codewords to a pair of addresses within2^(N+1) consecutive addresses. This can involve writing N bits to eachof the 2^(N+1) addresses in which case each bit of the Gray code issampled with four clock phases. Alternatively, this can involve writingbits of a respective Gray code codeword g₁, g₂, . . . , g_(N) as 4N bitsto each of the 2^(N+1) addresses by writing g₁, g₁, g₁, g₁, . . . ,g_(N), g_(N), g_(N), g_(N) to pairs of addresses. In this case, samplingeach bit of the Gray code with four clock phases involves receiving 4Ndata signals, and sampling N data signals with a first clock phase,sampling another N data signals with a second clock phase, samplinganother N data signals with a third clock phase; and sampling another Ndata signals with a fourth clock phase.

The detailed description above has focused on mechanisms for measuringthe read delay. Having determined what the delay is, the DQS enablecircuit 32 of FIG. 1 goes on to gate the DQS signal in accordance withthe delay thus determined. An example of a specific circuit for the DQSenable circuit 32 will now be described with reference to FIG. 8A. Hereit is assumed that both DQS 158 and the inverse of DQS labeled DQS# 160are received across the interface from the memory. There is a circuit180 for making the DQS enable circuit of FIG. 8A backwards compatiblewith DDR memory designs in which there is only a DQS signal, and noDQS#, referred to herein as DDR1 as opposed to DDR2 memories that haveboth signals. Thus, in DDR1 implementations, the DQS# needs to begenerated by the memory controller for that case. Circuit 180 selectsbetween DDR1 and DDR2 mode. The remaining circuitry 182 is responsiblefor generating a gated DQS# signal 172 (labeled dqsb_i) and a gated DQSsignal 173 (labeled dqs_i). If backward compatibility is not required,then circuit 180 is not necessary.

Circuit 182 has a first D flip-flop 144 for receiving an input 141 fromthe controller, which is asserted at a time corresponding to the readpath delay determined by the initialization sample, indicating when itis time to enable the DQS. It also receives a clock input at 140referred to as CLK (N), this indicating that the controller is able tochoose a clock phase for this input. Flip-flop 144 produces outputdqs_enable_ff 148. Similarly, a second D flip-flop 146 receives an input143 from the controller indicating when it is time to disable the DQS.This is clocked by a clock input 142 that is 180° out of phase with theclock 140 that was used to clock the first flip-flop 144. This Dflip-flop 146 produces a dqs_disable_ff output 150. The dqs_enable_ff148 and the inverse of dqs_disable_ff 150 are combined in AND gate 152the output of which is connected to an S (set) input of SR flip-flop154. The inverse of dqs_disable_ff 150 is also connected to the D inputof SR flip-flop 154. The Q output of flip-flop 154 is a dqs_enable_i 156and this is connected to a multiplexer select input of a firstmultiplexer 170 and a second multiplexer 171. The two inputs to themultiplexer 170 include a DQS# input 168, and VDD 169. The output ofmultiplexer 170 is dqsb_i and this is also input to the clock input ofSR flip-flop 154. The two inputs to the multiplexer 171 include a DQSinput 166, and VSS 177. The output of multiplexer 171 is dqs_i.

The operation of the circuit of FIG. 8A will now be described withreference to the timing diagram of FIG. 8B. FIG. 8B shows a plot foreach of DQS 166, DQS# 168, dqs_enable_ff 148, dqs_disable_ff 150,dqs_enable_i 156 and dqsb_i 172. Note that dqs_i 173 is enabledsynchronously with dqsb_i 172. At some point after transmitting a readcommand, at a time determined by the read delay that was previouslymeasured, the input 141 of D flip-flop 144 goes high under the controlof the memory controller. This is clocked in with the rising edge ofclock input 140. For the example of FIG. 8B, it can be seen thatdqs_enable_ff 178 goes high on the 270° clock phase. When this goeshigh, the output of AND gate 152 goes high and the set input to SRflip-flop 154 in turn causes dqs_enable_i to transition high. In FIG. 8Bit can be seen that dqs_enable_i 156 transitions high slightly after the270° clock phase. Once dqs_enable_i 156 is high, the DQS# input 168 tomultiplexer 170 is selected, and thus the DQS# appears on the dqsb_i172. When dqs_enable_ff 148 goes low some time later, the set input toSR flip-flop 154 goes low, but the D input is high because it is theinverse of dqs_disable_ff 150. As such, the dqs_enable_i 156 stays highfor now. The time between the rising edge of the dqs_enable_ff 148 andthe first rising edge of the DQS 166 is greater than a quarter clockcycle. This represents a tolerance for drift between the timing of theDQS and the timing using the main controller. A circuit is describedbelow for detecting when a drift of more than 90° has occurred so thatthe timing of the dqs_enable can be re-adjusted.

To disable the DQS#, at some later time the disable input 143 to Dflip-flop 146 goes high under the control of the memory controller. Thisis clocked in with a clock that is 180° later than the clock that wasused to clock in the enable input to D flip-flop 144. This produces thedqs_disable_ff output 150, the inverted input of which is connected tothe D input of SR flip-flop 154. Because of this, on the next risingedge of the clock input to SR flip-flop 154 (i.e. the next rising edgeof DQS#) dqs_enable_i goes low. This de-selects the DQS# input 168 tothe multiplexer 170, and dqsb_i 172 transitions to VDD. Thus in thetiming diagram it can be seen that after the dqs_disable_ff goes high,it is not until the next rising edge of dqsb_i that the dqs_enable_igoes low.

A specific circuit has been described for producing the multiplexerselect input 156, referred to generally as 197 in FIG. 8A. Moregenerally, a select input generator circuit can be used that sets theselect input to select the data strobe signal upon activation of thedata strobe enable, and that sets the select input to deselect the datastrobe signal upon activation of the data strobe disable and following anext rising edge of the data strobe signal.

Circuit 180 simply provides a mechanism for producing DQS# 168 and DQS166 from the single DQS input 158 for DDR1 implementations. The DQS#input 160 does not exist for DDR1 implementations. Circuit 180 consistsof first and second multiplexers 162,164. These are each connected toreceive the DQS input 158 and DQS# input 160. Multiplexer 162 alwaysselects DQS 158. When DDR2 is low, multiplexer 164 selects DQS output168 to be DQS# input 160. Otherwise it is produced from the inverse ofDQS 158. The inclusion of multiplexer 162 that always selects DQS 158ensures an equal load upon DQS and DQS#.

The DQS and DQS# are generated in the memory as a function of a clockreceived from the memory controller. However, by the time the DQS isreceived back at the memory controller, this clock has been transmittedfrom the memory controller to the memory, through the memory's circuitsand back out through DQS outputs. The result is that there is some driftbetween the DQS and DQS# outputs received by the memory controller andthe timing of the DQS enable and correspondingly the timing of thedqs_enable_ff, dqs_disable_ff, dqs_enable_i and dqsb_i of FIG. 8B.However, more generally in any DDR SDRAM implementation, the DQS signalcan be expected to drift somewhat with respect to main clock. Anotherembodiment of the invention provides a mechanism for detecting thisdrift, in particular for detecting when the drift is greater than 90°.Once the drift has reached 90°, this can be corrected for by updatingthe timing of the DQS enable and disable signals.

Referring now to FIG. 9A, shown is a circuit diagram of a data strobedrift detector provided by an embodiment of the invention. A DQS input190 is shown driving clock inputs of two D flip-flops 191,192. The Dinput of flip-flop 191 receives a 0° clock from a master DLL, while theD input of flip-flop 192 receives a 90° phase of the master DLL. Theoutput 196 of the first flip-flop 191 is referred to as drift<1> whilethe output 198 of the second flip-flop 192 is referred to as drift<0>collectively referred to as “drift outputs”.

The operation of the circuit of FIG. 9A will now be described withreference to the timing diagram of FIG. 9B. Shown is a 0° clock 300, a90° clock 302, DQS 190 and drift <1:0> 196,198. When DQS 190 transitionsfrom zero to one (rising edge) the state of the 0° and 90° clocks 300,302 are latched to the drift outputs 196,198. Four examples of thecontents that might be latched are shown in FIG. 9B. In the firstexample at 304 the drift outputs 196,198 are “10”. At a later samplinginstant 306 (next rising edge of DQS 190) the drift samples are still“10”. At a later sampling instant 308, the drift outputs 196,198 are now“11”. This is true again at a later sampling instant 310. The fact thatthe drift outputs changed from “10” to “11” at sampling instant 308 isindicative of the fact that a drift of greater than 90° has taken place.This information is then used by the memory controller to update the DQSenable and disable times.

It is noted that the DQS enable circuits of FIG. 8A can be used togetherwith any mechanism for determining the read delay. Furthermore, the datastrobe drift detector of FIG. 9A can be used in any circuit thatreceives a DQS signal that is drifting relative to a main clock. Aparticular application would be in circuits that employ the read delaydetermination methods and circuits described above and/or the DQS enableschemes described above.

A very specific drift detector circuit has been described. Moregenerally, a first circuit is provided that latches a first value of afirst phase of a master clock synchronously with an input clock signal.In the above example, the first circuit is a D flip-flop but otherimplementations are possible. There is a second circuit that latches asecond value of a second phase of the master clock synchronously withthe input clock signal. In the above example, the second circuit is a Dflip-flop but other implementations are possible. A change in either thefirst value or the second value indicates that the input clock signalhas drifted relative to the master clock source by at least apredetermined amount. For the particular example described, the firstclock phase is a 0° clock based on the master clock, and the secondclock phase is a 90° clock based on the master clock, and thepredetermined amount is a quarter clock cycle, but other shifts can bedetected by appropriately selecting the phases of the two clocks.

The specific examples above refer to DDR1 and DDR2. More generally,embodiments of the invention may be applicable to all industry standardDDR DRAMs that use bidirectional data strobes, including DDR, DDR2,DDR3, and the various versions of GDDR. More generally still,embodiments of the invention are applicable to a memory that has abidirectional read/write bus with source synchronous clocking, and abidirectional data strobe. The above-discussed DQS is a specific exampleof such a bidirectional data strobe. In the more general context, a datastrobe enable circuit is provided to enable the data strobe, the DQSenable circuit being a specific example of this.

They may also be useful in QDR and QDR2 SRAM to save internal clockpower by gating the data clocks and for implementing the clock domaincrossing.

Furthermore, the methods and circuits described herein may be used todetermine read delay for purposes other than enabling DQS. A specificexample is in determining drift and crossing data over clock boundaries.

They may also be useful in high speed serial interfaces. In theembodiments described above, the device elements and circuits areconnected to each other as shown in the figures, for the sake ofsimplicity. In practical applications of the present invention tosemiconductor ICs and DRAM devices, elements, circuits, etc. may beconnected directly to each other. As well, elements, circuits etc. maybe connected indirectly to each other through other elements, circuits,etc., necessary for operation of the semiconductor ICs and DRAM devices.Thus, in actual configuration of semiconductor ICs and DRAM devices, thecircuit elements and devices are coupled with (directly or indirectlyconnected to) each other.

The above-described embodiments of the present invention are intended tobe examples only. Alterations, modifications and variations may beeffected to the particular embodiments by those of skill in the artwithout departing from the scope of the invention, which is definedsolely by the claims appended hereto.

What is claimed is:
 1. A method for enabling a data strobe input in asynchronous memory controller comprising: determining a data strobeenable value and a data strobe edge value; starting a counter uponissuance of a read command; enabling the data strobe input when anoutput of the counter reaches the data strobe enable value; latching theoutput of the counter with an edge of the data strobe input to provide adata strobe edge sample; and if the data strobe edge sample differs fromthe data strobe edge value: adding the difference between the datastrobe edge sample and the data strobe edge value to the data strobeenable value, and replacing the data strobe edge value with the datastrobe edge sample.
 2. The method as claimed in claim 1 wherein latchingthe output of the counter comprises latching the output of the counteron the first edge of the data strobe input following enabling the datastrobe input.
 3. The method as claimed in claim 1 wherein latching theoutput of the counter comprises latching the output of the counter on arising edge of the data strobe input.
 4. The method as claimed in claim1 further comprising clocking the counter at four times a frequency ofthe data strobe input.
 5. A method for enabling a data strobe input in asynchronous memory controller comprising: determining a data strobeenable value, a first data strobe edge value, and a second data strobeedge value; enabling the data strobe input following issuance of a readcommand at a time determined by the data strobe enable value; latching aclock with an edge of the data strobe input for providing a first datastrobe edge sample; latching a phase shifted version of the clock withthe edge of the data strobe input for providing a second data strobeedge sample; and if the first data strobe edge sample differs from thefirst data strobe edge value or the second data strobe edge samplediffers from the second data strobe edge value: adjusting the datastrobe enable value for compensating for drift, and replacing the firstdata strobe edge value with the first data strobe edge sample and thesecond data strobe edge value with the second data strobe edge sample.6. The method as claimed in claim 5 wherein the clock and the phaseshifted version of the clock are latched on a first edge of the datastrobe input following enabling the data strobe input.
 7. The method asclaimed in claim 5 wherein the clock and the phase shifted version ofthe clock are latched on a rising edge of the data strobe input.
 8. Themethod as claimed in claim 5 wherein a frequency of the phase shiftedversion of the clock is substantially equal to a frequency of the clock.9. The method as claimed in claim 8 wherein the phase shifted version ofthe clock is shifted 90 degrees with respect to the clock.
 10. Themethod as claimed in claim 8 wherein the frequency of the phase shiftedversion of the clock and the frequency of the clock are substantiallyequal to a frequency of the data strobe input.
 11. A method for enablinga data strobe input in a synchronous memory controller comprising:determining a data strobe enable value and a data strobe edge value;starting a counter upon issuance of a read command; enabling the datastrobe input when an output of the counter reaches the data strobeenable value; latching the output of the counter with an edge of thedata strobe input to provide a data strobe edge sample; and adjustingthe data strobe enable value based on the data strobe edge sample. 12.The method as claimed in claim 11, further comprising adjusting the datastrobe edge value based on the data strobe edge sample.
 13. The methodas claimed in claim 12, wherein adjusting the data strobe edge valuecomprises replacing the data strobe edge value with the data strobe edgesample.
 14. The method as claimed in claim 11 wherein latching theoutput of the counter comprises latching the output of the counter onthe first edge of the data strobe input following enabling the datastrobe input.
 15. The method as claimed in claim 11 wherein latching theoutput of the counter comprises latching the output of the counter on arising edge of the data strobe input.
 16. The method as claimed in claim11 further comprising clocking the counter at four times a frequency ofthe data strobe input.